package org.javaqq.face.main.inter;

import java.io.*;

import org.javaqq.face.main.filetransfer.event.FileTransferListener;
import org.javaqq.face.main.orgmeta.inter.MetaContactInter;
import org.javaqq.face.protocol.OffLineFile;
import org.javaqq.face.protocol.OperationNotSupportedException;

public interface OperationSetFileTransfer
    extends OperationSet
{
    /**
     * Sends a file transfer request to the given <tt>toContact</tt> by
     * specifying the local and remote file path and the <tt>fromContact</tt>,
     * sending the file.
     * 
     * @param toContact the contact that should receive the file
     * @param file the file to send
     * 
     * @return the transfer object
     * 
     * @throws IllegalStateException if the protocol provider is not registered
     * or connected
     * @throws IllegalArgumentException if some of the arguments doesn't fit the
     * protocol requirements
     * @throws OperationNotSupportedException if the given contact client or
     * server does not support file transfers
     */
    public FileTransfer sendFile(   MetaContactInter toContact,
                                    File file)
        throws  IllegalStateException,
                IllegalArgumentException,
                OperationNotSupportedException;
    public FileTransfer sendOfflineFile(   MetaContactInter toContact,
            File file)
    throws  IllegalStateException,
    IllegalArgumentException,
    OperationNotSupportedException;
    /**
     * Sends a file transfer request to the given <tt>toContact</tt> by
     * specifying the local and remote file path and the <tt>fromContact</tt>,
     * sending the file.
     * 
     * @param toContact the contact that should receive the file
     * @param fromContact the contact sending the file
     * @param remotePath the remote file path
     * @param localPath the local file path
     * 
     * @return the transfer object
     * 
     * @throws IllegalStateException if the protocol provider is not registered
     * or connected
     * @throws IllegalArgumentException if some of the arguments doesn't fit the
     * protocol requirements
     * @throws OperationNotSupportedException if the given contact client or
     * server does not support file transfers.
     */
    public FileTransfer sendFile(   MetaContactInter toContact, 
    		MetaContactInter fromContact,
                                    String remotePath,
                                    String localPath)
        throws  IllegalStateException,
                IllegalArgumentException,
                OperationNotSupportedException;

    /**
     * Adds the given <tt>FileTransferListener</tt> that would listen for
     * file transfer requests and created file transfers.
     * 
     * @param listener the <tt>FileTransferListener</tt> to add
     */
    public void addFileTransferListener(
        FileTransferListener listener);

    /**
     * Removes the given <tt>FileTransferListener</tt> that listens for
     * file transfer requests and created file transfers.
     * 
     * @param listener the <tt>FileTransferListener</tt> to remove
     */
    public void removeFileTransferListener(
        FileTransferListener listener);

    /**
     * Returns the maximum file length supported by the protocol in bytes.
     * @return the file length that is supported.
     */
    public long getMaximumFileLength();
    
    public boolean receiveOffLineFile(OffLineFile file,long resumemark,String filePath);
    
    public boolean rejectOffLineFile(OffLineFile file);
}
